package login.bussiness;

import login.DAO.ConectionDAO;
import java.sql.SQLException;
import login.beans.ConectionBean;

/**
 *
 * @author juan
 */

public class ConectionBusiness {
    
    String user;
    String password;
    String host;
    String database;
    static final String SUCCESSFUL = "successful";

    public ConectionBusiness(String user, String password, String host, String database) {
        this.user = user;
        this.password = password;
        this.host = host;
        this.database = database;
    }
    
    public String login(ConectionBean conectionBean) throws SQLException {
        ConectionDAO conectionDAO = new ConectionDAO();
        try {
            conectionBean.currentConnection =
                    conectionDAO.login(user, password, host, database);
            return SUCCESSFUL;
        } catch (SQLException se) {
            return se.getMessage();
        }
    }
    
    
}

